package com.voice.call.job;

import javax.annotation.Resource;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Component;

import com.voice.call.service.LoginLogService;
import com.voice.call.service.NewsService;

import voice.voice.call.cache.NewsCountCache;
import voice.voice.call.cache.SmsCountCache;


@Component
public class SmsCountClearJob {
	
	private static final Logger log = LoggerFactory.getLogger(SmsCountClearJob.class);
	
	@Resource
	private SmsCountCache smsCountCache;
	
	@Resource
	private NewsCountCache newsCountCache;
	
	@Resource
	private NewsService newsService;
	
	@Resource
	private LoginLogService loginLogService;
	
	public void execute() {
		log.info("短信统计缓存清理定时任务开始...");
		smsCountCache.clear();
		log.info("短信统计缓存清理定时任务结束...");
		
		log.info("新闻统请求数清理定时任务开始...");
		newsCountCache.clear();
		log.info("新闻统计请求数清理定时任务结束...");
		
		log.info("清理7天前新闻数据定时任务开始...");
		newsService.clearHistoryNews();
		log.info("清理7天前新闻数据定时任务结束...");
		
		log.info("登录数据清理定时任务开始...");
		loginLogService.clearHistoryLoginData();
		log.info("登录数据清理定时任务结束...");
	}

}
